//
//  AddPhotoCollectionViewCell.m
//  YIJU2.0HD
//
//  Created by URANUS on 16/5/20.
//  Copyright © 2016年 Mr.X. All rights reserved.
//

#import "AddPhotoCollectionViewCell.h"
#import "Masonry.h"

@interface AddPhotoCollectionViewCell ()

@property (nonatomic, strong)UIButton *addBtn;

@end

@implementation AddPhotoCollectionViewCell

- (instancetype) initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setUpContaints];
    }
    return self;
}

- (void)setUpContaints {
    [self.addBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.mas_top).offset(FiveOffsetViewMargin);
        make.left.equalTo(self.mas_left).offset(FiveOffsetViewMargin);
        make.bottom.equalTo(self.mas_bottom).offset(-FiveOffsetViewMargin);
        make.right.equalTo(self.mas_right).offset(-FiveOffsetViewMargin);
    }];
}

- (UIButton *)addBtn {
    if (!_addBtn) {
        _addBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        _addBtn.backgroundColor = [UIColor colorWithRed:0.573 green:1.000 blue:0.316 alpha:1.000];
        [_addBtn setTitle:@"+" forState:UIControlStateNormal];
        _addBtn.titleLabel.font = [UIFont systemFontOfSize:50];
        [_addBtn addTarget:self action:@selector(buttonPressed:) forControlEvents:UIControlEventTouchUpInside];
        [self.contentView addSubview:_addBtn];
    }
    return _addBtn;
}

- (void)buttonPressed:(UIButton *)sender
{
#pragma mark -- 发送通知:
    [[NSNotificationCenter defaultCenter] postNotificationName:@"AddItem" object:nil];
    
}

@end
